unit CentroCustoDM;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  ZDataset, ZSqlUpdate, ZSequence, MainDM, QueryConditions, db;

type

  { TCentroCustoData }

  TCentroCustoData = class(TMainDataModule)
    CentroCustoDatasource: TDatasource;
    CentroCustoZQuerydesc_centro_custo: TStringField;
    CentroCustoZQueryid_centro_custo: TLargeintField;
    CentroCustoZQuerytipo: TStringField;
    CentroCustoZSequence: TZSequence;
    CentroCustoZUpdate: TZUpdateSQL;
    CentroCustoZQuery: TZQuery;
    procedure DataModuleCreate(Sender: TObject);
    /// Abre o DataSet
    procedure OpenDataSet(); override;
    /// Fecha o DataSet
    procedure CloseDataSet(); override;
    /// Realiza busca
    /// @param(Condicoes são as condições para a busca)
    /// @param(Tabela é a tabela no banco de dados)
    procedure Search(Condicoes: TQueryConditions; Tabela: string); override;
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  CentroCustoData: TCentroCustoData;

implementation

uses ConnectionDM;

{ TCentroCustoData }


procedure TCentroCustoData.DataModuleCreate(Sender: TObject);
begin
   MainDataSet := CentroCustoZQuery;
   CentroCustoZQuery.Open;
end;
procedure TCentroCustoData.OpenDataSet;
begin
  //ConnectionData.EmptyQuery(CentroCustoZQuery, 'centro_custo');
end;

procedure TCentroCustoData.CloseDataSet;
begin
  //CentroCustoZQuery.Close();
end;

procedure TCentroCustoData.Search(Condicoes: TQueryConditions; Tabela: string);
begin
    ConnectionData.OpenQueryConditions(CentroCustoZQuery, Tabela, Condicoes);
end;

initialization
  {$I centrocustodm.lrs}

end.

